package com.dd.controller;

import com.dd.entity.Book;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/books")
public class BookRestController {

    //新增图书
    @PostMapping("/saveBook")
    public String saveBook(@RequestBody Book book) {
        System.out.println("接收新增图书=====>" + book);

        return "新增图书";
    }

    //修改图书
    @PutMapping
    public String updateUser(@RequestBody Book book) {
        System.out.println("接收修改图书=====>" + book);

        return "修改图书";
    }

    //删除图书
    @DeleteMapping("/{bookId}")
    public String deleteBook(@PathVariable("bookId") Integer bookId) {
        System.out.println("接收删除图书信息=====>" + bookId);

        return "删除图书";
    }

    //获取全部用户信息
    @GetMapping
    public List<Book> getBookListRest() {
        System.out.println("获取全部结果集");
        return null;
    }

    //获取单个用户信息
    @GetMapping("/{id}")
    public Book getBookInfo(@PathVariable("id") Integer bookId) {
        System.out.println("返回单个用户信息=====>" + bookId);

        return null;
    }
}
